// export default {
//   mounted(el, binding) {
//     el.style.color = binding.value
//   }
// }

import { useIntersectionObserver } from '@vueuse/core'
export default {
  mounted(el, binding) {
    useIntersectionObserver(el, ([{ isIntersecting }]) => {
      console.log('isIntersecting: ', isIntersecting)
      if (isIntersecting) {
        //el元素是否在视口内
        el.src = new URL(`../../assets/img/${binding.value}`, import.meta.url).href //是就显示图片
      }
    })
  }
}
